import request from '@/utils/request'

/**
 * 获取负责人列表
 * @returns
 */
export const getEmployeesSimleApi = () => {
  return request({
    url: '/sys/user/simple'
  })
}

/**
 * 获取列表
 * @param {*} page 当前页码
 * @param {*} size 当前页容量
 * @returns
 */
export const getEmployeeListApi = (page, size) => {
  return request({
    url: '/sys/user',
    params: {
      page,
      size
    }
  })
}

/**
 * 删除员工
 * @param {*} id 员工的id
 * @returns
 */
export const delEmployeeByIdApi = id => {
  return request({
    url: `/sys/user/${id}`,
    method: 'delete'
  })
}

/**
 * 添加员工
 * @param {*} data 参数
 * @returns
 */
export const addEmployeeApi = data => {
  return request({
    url: '/sys/user',
    method: 'post',
    data
  })
}

/**
 * 批量上传员工
 * @param {*} list
 * @returns
 */
export const batchAddEmployeeApi = list => {
  return request({
    url: '/sys/user/batch',
    method: 'post',
    data: list
  })
}

/**
 * 修改员工
 * @param {*} data 参数
 * @returns
 */
export const editEmployeeApi = data => {
  return request({
    url: `/sys/user/${data.id}`,
    method: 'put',
    data
  })
}

/**
 * 编辑用户的角色信息
 * @param {*} data 参数
 * @returns
 */
export const editEmployeeRoleApi = data => {
  return request({
    url: '/sys/user/assignRoles',
    method: 'put',
    data
  })
}
